<?php
class ReturnCheckAction extends AdminAction
{
	public function __construct()
	{
		parent::__construct();
		$this->responseType = 'json';
	}
	
	public function execute()
	{
		$this->code		= 400;
		
		$id = $this->context->post('id');
		$status = $this->context->post('status');
		if(is_numeric($id) && $id && is_numeric($status))
		{
			$returnService = new ReturnService();
			$info = $returnService->get($id);
			if($info)
			{
				$returnService->update($id,array('status'=>$status,'check_time'=>Util::now()));
				$this->code = 200;
			}
			else
			{
				$this->code = 401;
			}
		}
	}
}
